import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:online_study/base/app_title.dart';
import 'package:online_study/classify/course_item.dart';
import 'package:online_study/course/course_detail.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//专题详情
class SpecialDetailsPage extends StatefulWidget {
  @override
  _SpecialDetailsPageState createState() => _SpecialDetailsPageState();
}

class _SpecialDetailsPageState extends State<SpecialDetailsPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ThemeColor.colorWhite,
      appBar: AppBar(
        leading: BackButton(color: ThemeColor.color333333),
        titleSpacing: 0,
        backgroundColor: ThemeColor.colorWhite,
        elevation: ThemeSize.appElevation,
        title: AppTitle("专题详情"),
      ),
      body: Column(
        children: [
          Container(
            height: ThemeSize.height126,
            width: double.infinity,
            margin: EdgeInsets.symmetric(
                vertical: ThemeSize.height12, horizontal: ThemeSize.width9),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(ThemeSize.width8),
                image: DecorationImage(
                    image: NetworkImage(
                        "https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg"),
                    fit: BoxFit.cover)),
          ),
          Expanded(
              child: ListView.separated(
            itemBuilder: (BuildContext context, int index) {
              return GestureDetector(
                child: Container(
                  margin: EdgeInsets.symmetric(horizontal: ThemeSize.width12),
                  child: CourseItemPage(false),
                ),
                onTap: () {
                  print("onTap");
                  Get.to(() => CourseDetailPage());
                },
              );
            },
            separatorBuilder: (BuildContext context, int index) {
              return Divider(height: ThemeSize.width1);
            },
            itemCount: 8,
          ))
        ],
      ),
    );
  }
}
